package arraybase;

import java.util.Arrays;

/**
 * ClassName: 数组复制
 * Package: arraybase
 * Description:
 *
 * @Author fjorid
 * @Create 2025/2/17 18:01
 * @Version 1.0
 */
public class 数组复制 {



    public static void main(String[] args) {
        int[] arr = {1, 2, 3, 4, 5};
            // 复制整个数组
            int[] copy1 = Arrays.copyOf(arr, arr.length);
            // 复制部分数组
            int[] copy2 = Arrays.copyOfRange(arr, 1, 3);

            System.out.println(Arrays.toString(copy1));
            System.out.println(Arrays.toString(copy2));
        }

}
